package com.mili.admin.blog.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.mili.admin.blog.entity.ArticleLableEntity;
import com.mili.admin.blog.service.ArticleLableService;
import com.mili.common.utils.PageUtils;
import com.mili.common.utils.R;



/**
 * 
 *
 * @author lujianhong
 * @email milimall@qq.com
 * @date 2020-10-26 14:02:33
 */
@RestController
@RequestMapping("blog/articlelable")
public class ArticleLableController {
    @Autowired
    private ArticleLableService articleLableService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("blog:articlelable:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = articleLableService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{articleLableId}")
    //@RequiresPermissions("blog:articlelable:info")
    public R info(@PathVariable("articleLableId") Integer articleLableId){
		ArticleLableEntity articleLable = articleLableService.getById(articleLableId);

        return R.ok().put("articleLable", articleLable);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("blog:articlelable:save")
    public R save(@RequestBody ArticleLableEntity articleLable){
		articleLableService.save(articleLable);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("blog:articlelable:update")
    public R update(@RequestBody ArticleLableEntity articleLable){
		articleLableService.updateById(articleLable);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("blog:articlelable:delete")
    public R delete(@RequestBody Integer[] articleLableIds){
		articleLableService.removeByIds(Arrays.asList(articleLableIds));

        return R.ok();
    }

}
